﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity.Framework;

using System.Data.Objects;

namespace Business.Operations
{
    public class MacGorevOperation
    {
        private static HPDMASEntities db = new HPDMASEntities();

        public MacGorevOperation()
        {

        }

        public static List<MacGorev> MacGorevGetAll()
        {
            var macGorevListesi = db.MacGorev.ToList();
            return macGorevListesi;
        }

        public static MacGorev MacGorevGetByMacGorevId(int macGorevId)
        {
            var macGorev = (from c in db.MacGorev where c.MacGorevID == macGorevId select c).First();
            return macGorev;
        }

        public static void MacGorevDelete(int macGorevId)
        {
            MacGorev k = (from c in db.MacGorev where c.MacGorevID == macGorevId select c).First();
            db.DeleteObject(k);
            db.SaveChanges();
        }

        public static List<string> MacGorevAdiGetAll()
        {
            var gorevAdi = (from c in db.MacGorev select c.MacGorevAdi).ToList();
            return gorevAdi;
        }

        public static int MacGorevIdGetByMacGorevAdi(string macGorevAdi)
        {
            var macGorevId = (from c in db.MacGorev where c.MacGorevAdi == macGorevAdi select c.MacGorevID).First();
            return macGorevId;
        }
    }
}
